package de.xt.logging.gui;

import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;

import de.xt.logging.utils.CopyTask;
import de.xt.logging.utils.ProcessCheck;
import de.xt.logging.utils.Propertie;

public class Gui {

	private JPanel jContentPane = null;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JCheckBox chckbxLoginNachrichten;
	private JCheckBox chckbxPartygesprche;
	private JCheckBox chckbxOocGesprche;
	private JCheckBox chckbxFarbcode;
	private JCheckBox chckbxPms;
	private JCheckBox chckbxServerrufe;
	private String source;
	private JFrame frame;

	private Propertie prob;
	private SystemTray SystemTray;
	private TrayIcon trayIcon;

	private JTextField textField_5;
	private JTextField textField_6;
	private File[] logs;

	private HashMap<String, String> config;

	/**
	 * @wbp.parser.entryPoint
	 */
	public void inti() {

		this.frame = new JFrame();
		Image icon = Toolkit.getDefaultToolkit().getImage("sources/ico.gif");
		this.frame.setIconImage(icon);
		frame.setResizable(false);
		this.config = new HashMap<String, String>();
		this.frame.setTitle("XT-19s Logging Tool");
		this.frame.setSize(new Dimension(393, 550));
		this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.frame.setContentPane(getJContentPane());

		try {
			this.prob = new Propertie("sources/Logging.ini");
			config.put("pathToLog", prob.readPropertie("pathtolog"));
			config.put("pathToStorage", prob.readPropertie("pathToStorage"));
			config.put("filterForLogin", prob.readPropertie("filterforlogin"));
			config.put("filterForCode", prob.readPropertie("filterforcode"));
			config.put("filterForParty", prob.readPropertie("filterforparty"));
			config.put("filterForPn", prob.readPropertie("filterforpn"));
			config.put("filterForOoc", prob.readPropertie("filterforooc"));
			config.put("filterForShouts", prob.readPropertie("filterforshouts"));
			config.put("formating", prob.readPropertie("formating"));
			config.put("prefix", prob.readPropertie("prefix"));
			config.put("pathToExe", prob.readPropertie("pathToProgram"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		textField.setText(config.get("pathToLog"));
		try {
			String pathToStorage = prob.readPropertie("pathToStorage");
			System.out.print(pathToStorage);
		} catch (IOException e) {
			new Popup("Fehler!", e.getMessage());
		}
		textField_3.setText(config.get("pathToStorage"));
		textField_1.setText(config.get("formating"));
		textField_2.setText(config.get("prefix"));
		
		if ("True".equals(config.get("filterForLogin")))
			chckbxLoginNachrichten.setSelected(true);
		else
			chckbxLoginNachrichten.setSelected(false);
		
		if ("True".equals(config.get("filterForCode")))
			chckbxFarbcode.setSelected(true);
		else
			chckbxFarbcode.setSelected(false);

		if ("True".equals(config.get("filterForOoc")))
			chckbxOocGesprche.setSelected(true);
		else
			chckbxOocGesprche.setSelected(false);

		if ("True".equals(config.get("filterForParty")))
			chckbxPartygesprche.setSelected(true);
		else
			chckbxPartygesprche.setSelected(false);

		if ("True".equals(config.get("filterForPn")))
			chckbxPms.setSelected(true);
		else
			chckbxPms.setSelected(false);

		if ("True".equals(config.get("filterForShouts")))
			chckbxServerrufe.setSelected(true);
		else
			chckbxServerrufe.setSelected(false);

		this.frame.setVisible(true);
		ProcessCheck pc = new ProcessCheck();
		pc.backup = false;
		pc.backupPath = config.get("backupPath");
		pc.farbcode = chckbxFarbcode.isSelected();
		pc.file = new File(config.get("pathToLog"));
		pc.formating = config.get("formating");
		pc.isWindows = true;
		pc.loginNachrichten = chckbxLoginNachrichten.isSelected();
		pc.ooc = chckbxOocGesprche.isSelected();
		pc.party = chckbxPartygesprche.isSelected();
		pc.pathToStorage = config.get("pathToStorage");
		pc.pns = chckbxPartygesprche.isSelected();
		pc.prefix = config.get("prefix");
		pc.shouts = chckbxServerrufe.isSelected();
		pc.start();

	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();

			JButton btnOk = new JButton("OK");
			btnOk.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					frame.setVisible(false);
					if (java.awt.SystemTray.isSupported()) {
						SystemTray = java.awt.SystemTray.getSystemTray();
						Image image = Toolkit.getDefaultToolkit().getImage(
								"sources/ico.gif");
						MouseListener mouseListener = new MouseListener() {

							public void mouseClicked(MouseEvent e) {
								frame.setVisible(true);
								frame.setExtendedState(JFrame.NORMAL);
							}

							public void mousePressed(MouseEvent e) {

							}

							public void mouseReleased(MouseEvent e) {

							}

							public void mouseEntered(MouseEvent e) {

							}

							public void mouseExited(MouseEvent e) {

							}

						};

						ActionListener exitListener = new ActionListener() {
							public void actionPerformed(ActionEvent e) {
								System.out.println("Exiting...");
								System.exit(0);
							}
						};

						PopupMenu popup = new PopupMenu();
						MenuItem defaultItem = new MenuItem("Beenden");
						defaultItem.addActionListener(exitListener);
						popup.add(defaultItem);
						trayIcon = new TrayIcon(image, "XT-19s Logging Tool",
								popup);

						trayIcon.setImageAutoSize(true);
						trayIcon.addMouseListener(mouseListener);
						try {
							SystemTray.add(trayIcon);
						} catch (NullPointerException e2) {
							e2.printStackTrace();
						} catch (AWTException e1) {
							e1.printStackTrace();
						}
					}
				}
			});
			btnOk.addMouseListener(new MouseAdapter() {
				@SuppressWarnings("static-access")
				@Override
				public void mouseClicked(MouseEvent e) {
					frame.setState(frame.ICONIFIED);
				}
			});
			jContentPane.setLayout(new FormLayout(new ColumnSpec[] {
					FormFactory.UNRELATED_GAP_COLSPEC,
					ColumnSpec.decode("270px"),
					FormFactory.RELATED_GAP_COLSPEC,
					FormFactory.DEFAULT_COLSPEC,
					FormFactory.UNRELATED_GAP_COLSPEC,
					ColumnSpec.decode("78px"), },
					new RowSpec[] { FormFactory.UNRELATED_GAP_ROWSPEC,
							RowSpec.decode("469px"),
							FormFactory.UNRELATED_GAP_ROWSPEC,
							RowSpec.decode("28px"), }));
			jContentPane.add(btnOk, "2, 4, right, fill");

			JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
			jContentPane.add(tabbedPane, "2, 2, 3, 1, fill, fill");
			JPanel panel2 = new JPanel();
			JPanel panel3 = new JPanel();
			panel3.setBorder(new TitledBorder(null, "", TitledBorder.LEADING,
					TitledBorder.TOP, null, null));

			JPanel panel = new JPanel();
			panel.setBorder(new TitledBorder(null, "", TitledBorder.LEADING,
					TitledBorder.TOP, null, null));
			tabbedPane.addTab("Einstellungen", null, panel, null);
			tabbedPane.setEnabledAt(0, true);
			panel.setLayout(null);

			Box verticalBox = Box.createVerticalBox();
			verticalBox.setBounds(166, 5, 0, 0);
			panel.add(verticalBox);

			JPanel panel_1 = new JPanel();
			panel_1.setBounds(10, 11, 333, 103);
			panel_1.setBorder(new TitledBorder(null, "Log Einstellungen",
					TitledBorder.LEADING, TitledBorder.TOP, null, null));
			panel.add(panel_1);
			panel_1.setLayout(null);

			textField = new JTextField();
			textField.setFont(new Font("Dialog", Font.PLAIN, 11));
			textField.setBounds(16, 28, 249, 27);
			panel_1.add(textField);
			textField.setColumns(10);
			textField.setEditable(false);

			JButton btnLogauswhlen = new JButton("...");
			btnLogauswhlen.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					JFileChooser source = new JFileChooser();
					int state = source.showOpenDialog(null);
					if (state == JFileChooser.APPROVE_OPTION) {
						Gui.this.source = source.getSelectedFile().toString();
						textField.setText(Gui.this.source);
						try {
							prob.writePropertie("pathtolog", source
									.getSelectedFile().toString());
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					}
				}
			});
			btnLogauswhlen.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
				}
			});
			btnLogauswhlen.setBounds(277, 27, 37, 28);
			panel_1.add(btnLogauswhlen);

			JLabel lblPfadZurNwn = new JLabel("Pfad zur NWN2 Log Datei");
			lblPfadZurNwn.setFont(new Font("Dialog", Font.BOLD, 11));
			lblPfadZurNwn.setBounds(16, 59, 190, 26);
			panel_1.add(lblPfadZurNwn);

			JPanel panel_2 = new JPanel();
			panel_2.setBounds(10, 113, 333, 120);
			panel_2.setBorder(new TitledBorder(null, "Filter",
					TitledBorder.LEADING, TitledBorder.TOP, null, null));
			panel.add(panel_2);
			panel_2.setLayout(null);

			chckbxLoginNachrichten = new JCheckBox("Login Nachrichten");
			chckbxLoginNachrichten.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					if (chckbxLoginNachrichten.isSelected()) {
						try {
							prob.writePropertie("filterforlogin", "True");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					} else {
						try {
							prob.writePropertie("filterforlogin", "False");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}

					}
				}
			});
			chckbxLoginNachrichten.setBounds(6, 21, 174, 23);
			panel_2.add(chckbxLoginNachrichten);

			chckbxPartygesprche = new JCheckBox("Partygespräche");
			chckbxPartygesprche.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					if (chckbxPartygesprche.isSelected()) {
						try {
							prob.writePropertie("filterforparty", "True");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					} else {
						try {
							prob.writePropertie("filterforparty", "False");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}

					}
				}
			});
			chckbxPartygesprche.setBounds(6, 47, 174, 23);
			panel_2.add(chckbxPartygesprche);

			chckbxOocGesprche = new JCheckBox("OOC Gespräche");
			chckbxOocGesprche.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					if (chckbxOocGesprche.isSelected()) {
						try {
							prob.writePropertie("filterforooc", "True");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					} else {
						try {
							prob.writePropertie("filterforooc", "False");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					}
				}
			});
			chckbxOocGesprche.setBounds(6, 73, 174, 23);
			panel_2.add(chckbxOocGesprche);

			chckbxFarbcode = new JCheckBox("Farbcode");
			chckbxFarbcode.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					if (chckbxLoginNachrichten.isSelected()) {
						try {
							prob.writePropertie("filterforLogin", "True");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					} else {
						try {
							prob.writePropertie("filterforLogin", "False");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					}
				}
			});
			chckbxFarbcode.setBounds(184, 21, 121, 23);
			panel_2.add(chckbxFarbcode);

			chckbxPms = new JCheckBox("PMs");
			chckbxPms.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					if (chckbxPms.isSelected()) {
						try {
							prob.writePropertie("filterforpn", "True");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					} else {
						try {
							prob.writePropertie("filterforpn", "False");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					}
				}
			});
			chckbxPms.setBounds(184, 47, 121, 23);
			panel_2.add(chckbxPms);

			chckbxServerrufe = new JCheckBox("Serverrufe");
			chckbxServerrufe.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {
					if (chckbxLoginNachrichten.isSelected()) {
						try {
							prob.writePropertie("filterforshouts", "True");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					} else {
						try {
							prob.writePropertie("filterforshouts", "False");
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					}
				}
			});
			chckbxServerrufe.setBounds(184, 73, 121, 23);
			panel_2.add(chckbxServerrufe);

			JPanel panel_3 = new JPanel();
			panel_3.setBounds(10, 237, 333, 196);
			panel_3.setBorder(new TitledBorder(null, "Speichereinstellungen",
					TitledBorder.LEADING, TitledBorder.TOP, null, null));
			panel.add(panel_3);
			panel_3.setLayout(null);

			textField_1 = new JTextField();
			textField_1.setFont(new Font("Dialog", Font.PLAIN, 11));
			textField_1.addPropertyChangeListener(new PropertyChangeListener() {
				public void propertyChange(PropertyChangeEvent evt) {

				}
			});
			textField_1.addKeyListener(new KeyAdapter() {
				@Override
				public void keyPressed(KeyEvent e) {

				}
			});

			textField_1.getDocument().addDocumentListener(
					new DocumentListener() {

						public void removeUpdate(DocumentEvent e) {
							try {
								prob.writePropertie("formating",
										textField_1.getText());
							} catch (IOException e1) {
								new Popup("Fehler!", e1.getMessage());
							}
						}

						public void insertUpdate(DocumentEvent e) {
							try {
								prob.writePropertie("formating",
										textField_1.getText());
							} catch (IOException e1) {
								new Popup("Fehler!", e1.getMessage());
							}
						}

						public void changedUpdate(DocumentEvent e) {
							try {
								prob.writePropertie("formating",
										textField_1.getText());
							} catch (IOException e1) {
								new Popup("Fehler!", e1.getMessage());
							}
						}
					});
			textField_1.setBounds(10, 33, 252, 27);
			panel_3.add(textField_1);
			textField_1.setColumns(10);

			textField_2 = new JTextField();
			textField_2.setFont(new Font("Dialog", Font.PLAIN, 11));
			textField_2.setBounds(10, 90, 252, 25);
			panel_3.add(textField_2);
			textField_2.setColumns(10);
			textField_2.getDocument().addDocumentListener(
					new DocumentListener() {

						public void removeUpdate(DocumentEvent e) {
							try {
								prob.writePropertie("prefix",
										textField_2.getText());
							} catch (IOException e1) {
								new Popup("Fehler!", e1.getMessage());
							}
						}

						public void insertUpdate(DocumentEvent e) {
							try {
								prob.writePropertie("prefix", textField_2.getText());
							} catch (IOException e1) {
								new Popup("Fehler!", e1.getMessage());
							}
						}

						public void changedUpdate(DocumentEvent e) {
							try {
								prob.writePropertie("prefix", textField_2.getText());
							} catch (IOException e1) {
								new Popup("Fehler!", e1.getMessage());
							}

						}
					});

			JButton button = new JButton("...");
			button.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
				}
			});
			button.setBounds(274, 32, 37, 28);
			panel_3.add(button);

			JLabel lblFormatierungDesDatums = new JLabel(
					"Formatierung des Datums");
			lblFormatierungDesDatums.setFont(new Font("Dialog", Font.BOLD, 11));
			lblFormatierungDesDatums.setBounds(10, 58, 288, 20);
			panel_3.add(lblFormatierungDesDatums);

			JLabel lblPrefix = new JLabel("Prefix");
			lblPrefix.setFont(new Font("Dialog", Font.BOLD, 11));
			lblPrefix.setBounds(10, 115, 189, 20);
			panel_3.add(lblPrefix);

			textField_3 = new JTextField();
			textField_3.setFont(new Font("Dialog", Font.PLAIN, 11));
			textField_3.setBounds(10, 139, 252, 25);
			panel_3.add(textField_3);
			textField_3.setColumns(10);
			textField_3.setEditable(false);

			JLabel lblPfadZumNeuen = new JLabel("Pfad zum neuen Verzeichnis");
			lblPfadZumNeuen.setFont(new Font("Dialog", Font.BOLD, 11));
			lblPfadZumNeuen.setBounds(10, 161, 189, 29);
			panel_3.add(lblPfadZumNeuen);

			JButton button_1 = new JButton("...");
			button_1.addActionListener(new ActionListener() {
				@SuppressWarnings("static-access")
				public void actionPerformed(ActionEvent e) {
					JFileChooser target = new JFileChooser();
					target.setFileSelectionMode(target.DIRECTORIES_ONLY);
					int state = target.showOpenDialog(null);
					if (state == target.APPROVE_OPTION) {
						textField_3
								.setText(target.getSelectedFile().toString());
						try {
							prob.writePropertie("pathtostorage", target.getSelectedFile()
									.toString());
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					}
				}
			});
			button_1.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent e) {

				}

			});
			button_1.setBounds(274, 88, 37, 28);
			panel_3.add(button_1);

			JButton btnNewButton = new JButton("New button");
			btnNewButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {

					JFileChooser saveDialog = new JFileChooser();
					saveDialog
							.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
					int state = saveDialog.showOpenDialog(null);
					if (state == JFileChooser.APPROVE_OPTION) {
						config.put("pathToStorage", saveDialog.getSelectedFile().toString());
						textField_3.setText(saveDialog.getSelectedFile().toString());
						try {
							prob.writePropertie("pathToStorage", saveDialog.getSelectedFile().toString());
						} catch (IOException e1) {
							new Popup("Fehler!", e1.getMessage());
						}
					}
				}
			});
			btnNewButton.setBounds(274, 137, 37, 28);
			panel_3.add(btnNewButton);
			tabbedPane.addTab("Verschiedene Tools", null, panel2, null);
			panel2.setLayout(null);

			JPanel panel_5 = new JPanel();
			panel_5.setBorder(new TitledBorder(null, "Alte Logs filtern",
					TitledBorder.LEADING, TitledBorder.TOP, null, null));
			panel_5.setBounds(10, 28, 313, 186);
			panel2.add(panel_5);
			panel_5.setLayout(null);

			textField_5 = new JTextField();
			textField_5.setFont(new Font("Dialog", Font.PLAIN, 11));
			textField_5.setEditable(false);
			textField_5.setBounds(10, 21, 244, 27);
			panel_5.add(textField_5);
			textField_5.setColumns(10);

			JButton button_3 = new JButton("...");
			button_3.addActionListener(new ActionListener() {
				@SuppressWarnings("static-access")
				public void actionPerformed(ActionEvent e) {
					JFileChooser logs = new JFileChooser();
					logs.setMultiSelectionEnabled(true);
					int state = logs.showOpenDialog(null);
					if (state == logs.APPROVE_OPTION) {
						Gui.this.logs = logs.getSelectedFiles();
						config.put("logs", logs.getSelectedFiles().toString());
						String display = logs.getSelectedFile().getPath();
						textField_5.setText(display);
					}
				}
			});
			button_3.setBounds(266, 20, 37, 28);
			panel_5.add(button_3);

			JLabel lblPfadZuDen = new JLabel("Pfad zu den alten Logs");
			lblPfadZuDen.setFont(new Font("Dialog", Font.BOLD, 11));
			lblPfadZuDen.setBounds(10, 52, 193, 14);
			panel_5.add(lblPfadZuDen);

			textField_6 = new JTextField();
			textField_6.setFont(new Font("Dialog", Font.PLAIN, 11));
			textField_6.setEditable(false);
			textField_6.setBounds(10, 77, 244, 27);
			panel_5.add(textField_6);
			textField_6.setColumns(10);

			JButton button_4 = new JButton("...");
			button_4.addActionListener(new ActionListener() {
				@SuppressWarnings("static-access")
				public void actionPerformed(ActionEvent e) {
					JFileChooser backup = new JFileChooser();
					backup.setFileSelectionMode(backup.DIRECTORIES_ONLY);
					int state = backup.showOpenDialog(null);
					if (state == backup.APPROVE_OPTION) {
						config.put("backupPath", backup.getSelectedFile().toString());
						textField_6.setText(config.get("backupPath"));
					}
				}
			});
			button_4.setBounds(266, 76, 37, 28);
			panel_5.add(button_4);

			JLabel lblPfadFrDie = new JLabel("Pfad für die Backups");
			lblPfadFrDie.setFont(new Font("Dialog", Font.BOLD, 11));
			lblPfadFrDie.setBounds(10, 108, 193, 14);
			panel_5.add(lblPfadFrDie);

			JButton btnFiltern = new JButton("Filtern");
			btnFiltern.setFont(new Font("Dialog", Font.BOLD, 11));
			btnFiltern.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					for (File file : Gui.this.logs) {
						CopyTask.copyLog(file , false, config.get("backupPath"), config.get("formating"), config.get("pathToStorage"), config.get("prefix"), chckbxOocGesprche.isSelected(), chckbxFarbcode.isSelected(), chckbxLoginNachrichten.isSelected(), chckbxPartygesprche.isSelected(), chckbxPartygesprche.isSelected(), chckbxServerrufe.isSelected());
					}
					new Popup("Erfolg!","Log-Datei umkopiert!");
				}
			});
			btnFiltern.setBounds(128, 139, 63, 27);
			panel_5.add(btnFiltern);
			tabbedPane.addTab("Über", null, panel3, null);
			panel3.setLayout(null);

			JPanel panel_6 = new JPanel();
			panel_6.setBounds(215, 11, 108, 133);
			panel3.add(panel_6);

			JPanel panel_7 = new JPanel();
			panel_7.setBounds(10, 11, 195, 294);
			panel3.add(panel_7);
			panel_7.setLayout(null);

			JTextArea txtrcXt = new JTextArea();
			txtrcXt.setBackground(UIManager
					.getColor("TextArea.inactiveForeground"));
			txtrcXt.setFont(new Font("Arial", Font.PLAIN, 11));
			txtrcXt.setText("(C) XT-19 07.01.2011\r\n\r\nGeschrieben für \r\ndie NWN2 Community\r\n\r\nVielen Dank an \r\nGangzzta 61 und eisperle für das \r\nTesten und Feeback! ");
			txtrcXt.setEditable(false);
			txtrcXt.setRows(20);
			txtrcXt.setBounds(0, 0, 202, 294);
			panel_7.add(txtrcXt);

			JButton btnBeenden = new JButton("Beenden");
			btnBeenden.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					System.exit(0);
				}
			});
			jContentPane.add(btnBeenden, "4, 4, fill, fill");
		}
		return jContentPane;
	}

//	private void copyLog(File file, boolean backup) {
//		try {
//			FileInputStream inFile = new FileInputStream(file);
//			BufferedReader reader = new BufferedReader(new InputStreamReader(
//					inFile));
//			String newContent = "";
//			if (reader.ready()) {
//				String line = reader.readLine();
//				while (line != null) {
//					newContent = newContent + line + "\n";
//					line = reader.readLine();
//				}
//			}
//			inFile.close();
//			if (backup && config.get("backupPath") != null) {
//				String[] pieces = file.getName().split(File.pathSeparator);
//				String orgFileName = pieces[pieces.length - 1];
//				String filename = this.backupPath + "/" + orgFileName;
//				FileWriter fwrite = new FileWriter(filename);
////				BufferedWriter out = new BufferedWriter(fwrite);
//				BufferedWriter out = new BufferedWriter(fwrite,8192);
//				out.write(newContent);
//				out.close();
//			}
//
//			String[] patternsForOoc = new String[3];
//			patternsForOoc[0] = "\\(\\(.*\\)\\)";
//			patternsForOoc[1] = "\\/\\/";
//			patternsForOoc[2] = "\\*\\*.*\\*\\*";
//			Filter filter = new Filter();
//			if (chckbxOocGesprche.isSelected()) {
//				try {
//					newContent = filter.filterReplace(newContent,
//							patternsForOoc);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//
//			String[] patternsForCode = new String[6];
//			patternsForCode[0] = "<color=[a-zA-Z0-9#]*>";
//			patternsForCode[1] = "</color>";
//			patternsForCode[2] = "<i>";
//			patternsForCode[3] = "</c>";
//			patternsForCode[4] = "</i>";
//			patternsForCode[5] = "<c=[a-zA-Z0-9#]*>";
//			if (chckbxFarbcode.isSelected()) {
//				try {
//					newContent = filter.filterReplace(newContent,
//							patternsForCode);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//			newContent = newContent.replaceAll("  ", " ");
//			// }
//			String[] lines = newContent.split("\n");
//			Vector<String> content = new Vector<String>();
//			for (String line : lines) {
//				boolean toFiltered = false;
//
//				if (filter.checkIfLineShouldBeFiltered(line, "^\\[[\\w]\\]*")
//						&& chckbxLoginNachrichten.isSelected()) {
//					toFiltered = true;
//				}
//
//				if (filter.checkIfLineShouldBeFiltered(line,
//						"^\\[.*\\] .*:  \\[Gruppe\\]|\\[Party\\]")
//						&& chckbxPartygesprche.isSelected()) {
//					toFiltered = true;
//				}
//
//				if (filter.checkIfLineShouldBeFiltered(line,
//						"^\\[.*\\] .*:  \\[Sprechen\\]|\\[Tell\\]")
//						&& chckbxPms.isSelected()) {
//					toFiltered = true;
//				}
//
//				if (filter.checkIfLineShouldBeFiltered(line,
//						"^\\[.*\\] .*:  \\[Ruf\\]|\\[Shout\\]")
//						&& chckbxServerrufe.isSelected()) {
//					toFiltered = true;
//				}
//
//				if (!toFiltered) {
//					content.add(line);
//				}
//			}
//
//			Date dt = new Date();
//			SimpleDateFormat df = new SimpleDateFormat(config.get("formating"));
//			String filename = config.get("pathToStorage") + "/" + config.get("prefix")
//					+ df.format(dt) + ".log";
//			FileWriter fwrite = new FileWriter(filename);
//			BufferedWriter out = new BufferedWriter(fwrite);
//			for (String line : content) {
//				out.write(line);
//				out.newLine();
//			}
//		} catch (FileNotFoundException e) {
//			e.printStackTrace();
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
//	}
//
//	private void runNWN() throws IOException, InterruptedException {
//		Process theProcess = null;
//		theProcess = Runtime.getRuntime().exec(config.get("pathToExe"));
//		theProcess.waitFor();
//	}
}
